package com.we.connect.weconnect.quarte;

import com.we.connect.weconnect.model.remind.vo.RemindInfoVo;
import com.we.connect.weconnect.model.system.SysInfo;
import com.we.connect.weconnect.utils.SendMsg;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.io.IOException;

public class WeConnectJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        RemindInfoVo remindInfoVo = (RemindInfoVo) context.getMergedJobDataMap().get("remindInfoVo");
        SysInfo sysInfo = (SysInfo) context.getMergedJobDataMap().get("sysInfo");
        String resultMessage;
        try {
            resultMessage = SendMsg.sendMessage(sysInfo, remindInfoVo.getToUser().split("-")[0], remindInfoVo);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        System.out.println(resultMessage);
    }
}
